#ifndef __MPU6050
#define __MPU6050
#include "i2c.h"
#include "stdbool.h"

#define SENSORS_NBR_OF_BIAS_SAMPLES 200
typedef struct
{
	bool       isBiasValueFound;
	bool       isBufferFilled;
	bool		jzSuccess;
	float      buffer[3][SENSORS_NBR_OF_BIAS_SAMPLES];
}Offset_st;

typedef struct
{
	float x;
	float y;
	float z;
}GYRO_OFFSET;
extern GYRO_OFFSET gyro_offset;

typedef struct
{
	float x;
	float y;
	float z;
}mpu6050_data;

extern mpu6050_data gyro,acc;
extern Offset_st gyroOffsetRunning;
extern bool JZ_flag;
extern float Accel_Angle_x, Accel_Angle_y;
extern float balance_gyro_y;
extern float balance_acc_pitch;
extern float balance_pitch;

extern float balance_gyro_x;
extern float balance_acc_roll;
extern float balance_roll;

extern float balance_gyro_z;
extern float balance_acc_yaw;
extern float balance_yaw;

extern float Pitch;
extern float Roll;
extern float Yaw;




void MPU6050_Init(void);
void MPU6050_Read_Accel(mpu6050_data *pAcc);
void MPU6050_Read_Gyro(mpu6050_data *pGyro);
void average_zlc(mpu6050_data *gyro,float *gxx,float *gyy,float *gzz);
void gyro_to_oula(mpu6050_data *gyro);
void acc_to_oula(mpu6050_data *gyro);
//void Average_bmi088(mpu6050_data *gyro,float *Offsetout);
void Average_bmi088(mpu6050_data *gyro,GYRO_OFFSET *gyro_offset);
//void MPU6050_Read_Gyro(float*gx,float*gy,float*gz);
void Get_Balance_Angle(void);
void ImuUpdate(float gx, float gy, float gz, float ax, float ay, float az);

#endif
